package com.wechat.api.service.impl;

import com.wechat.api.config.WeChatConfigProperties;
import com.wechat.api.enums.WeChatEnums;
import com.wechat.api.param.GetOpenIdParam;
import com.wechat.api.service.WeChatApi;
import com.wechat.api.util.WeChatUtil;
import lombok.extern.slf4j.Slf4j;

/**
 * @Descriptio: 微信api接口
 */
@Slf4j
public class WeChatApiImpl implements WeChatApi {

    public WeChatApiImpl(WeChatConfigProperties properties){
        this.properties = properties;
    }

    private WeChatConfigProperties properties;

    public String getOpenId(String code) {
        GetOpenIdParam getOpenIdParam = new GetOpenIdParam(properties,code);
        return WeChatUtil.httpRequest(getOpenIdParam.url(WeChatEnums.LOGIN));
    }
}
